package com.linciping.room.sample1

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import kotlinx.coroutines.flow.Flow

@Dao
interface AreaDao {

    @Query("select * from area")
    fun getAll(): Flow<MutableList<Area>>

    @Query("select * from area where id=:areaId LIMIT 1")
    fun getAreaById(areaId: Long): Flow<Area>

    @Insert
    suspend fun insert(area: Area): Long

    @Delete
    suspend  fun delete(area: Area): Int
}